package org.squabble.domain.property;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

import org.squabble.domain.Account;
import org.squabble.domain.AccountProperty;

@Entity(name = "accountDateProperty")
@DiscriminatorValue("D")
public class AccountDateProperty extends AccountProperty {

	private static final long serialVersionUID = 1L;

	public AccountDateProperty() {
		super();
		// TODO Auto-generated constructor stub
	}

	public AccountDateProperty(Account account, String name, Date value) {
		super.setName(name);
		super.setAccount(account);
		this.setObject(value);
	}

	@Column(name = "DATE_VALUE")
	protected Date value = null;

	public boolean isStorable(Object value) {
		if (value == null)
			return true;
		return (Date.class.isAssignableFrom(value.getClass()));
	}

	public Object getObject() {
		return value;
	}

	public void setObject(Object value) {
		this.value = (Date) value;
	}
}
